import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BizStationLeakDetectVo, BizStationLeakSummaryVo } from './types';

/**
 * 查询站房泄露检测汇总
 * @param query
 * @returns {*}
 */

export const listLeakSummary = (query?: PageQuery): AxiosPromise<BizStationLeakSummaryVo[]> => {
  return request({
    url: '/biz-station/station/leak/list/summary',
    method: 'get',
    params: query
  });
};
/**
 * 查询站房泄露检测记录
 * @param query
 * @returns {*}
 */

export const listLeak = (query?: PageQuery): AxiosPromise<BizStationLeakDetectVo[]> => {
  return request({
    url: '/biz-station/station/leak/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询详细
 * @param id
 */
export const getLeak = (id: string | number): AxiosPromise<BizStationLeakDetectVo> => {
  return request({
    url: '/biz-station/station/leak/' + id,
    method: 'get'
  });
};

/**
 * 新增检测
 * @param query
 * @returns {*}
 */

export const addLeak = (data?: BizStationLeakDetectVo) => {
  return request({
    url: '/biz-station/station/leak',
    method: 'post',
    data: data
  });
};

/**
 * 修改检测
 * @param query
 * @returns {*}
 */

export const updateLeak = (data?: BizStationLeakDetectVo) => {
  return request({
    url: '/biz-station/station/leak',
    method: 'put',
    data: data
  });
};

/**
 * 删除检测记录
 * @param id
 */
export const delLeak = (id: string | number | Array<string | number>) => {
  return request({
    url: '/biz-station/station/leak/' + id,
    method: 'delete'
  });
};


/**
 * 查询分析数据
 * @param query
 * @returns {*}
 */

export const getLeakAnalysis = (data?: BizStationLeakDetectVo) => {
  return request({
    url: '/biz-station/station/leak/analysis',
    method: 'post',
    data: data
  });
};